package utils.nfc.xml
{
	public class NfcTags
	{
		private var pageID:String;
		private var lastChange:String;
		private var technology:String;
		private var hasContent:Boolean;
		private var nfcTagsArray:Array;
		
		public function NfcTags(nfcTags:Array, pageID:String="", technology:String="", hasContent:Boolean = true)
		{
			this.pageID = pageID;
			this.hasContent = hasContent;
			this.lastChange = new Date().time+"";
			this.technology = technology;
			this.nfcTagsArray = nfcTags;
		}
		
		public function toXML():XML{
			var nfcTags:XML = <nfcTags/>;
			nfcTags.@lastChange = lastChange;
			
			if (pageID != "")
				nfcTags.@pageID 	= pageID;
			if (technology != "")
				nfcTags.@technology = technology;

			nfcTags.@hasContent = hasContent;
			
			for (var i:int = 0; i < nfcTagsArray.length; i++) 
			{
				var curNfcTag:NfcTag = nfcTagsArray[i];
				nfcTags.appendChild(curNfcTag.toXML());
			}
			
			return nfcTags;
		}
		
	}
}